// 数据埋点

import MD5 from "@/utils/md5.js";
import {
  sendArticleDetailBuryingPoint,
} from "@/api/modules/buryingPoint";
export const articleDetailBuryingPoint = function (promote_id, promote_way) {

  if(!promote_id){
    console.log('promote_id 是空的');
    return;
  }
  var personId = uni.getStorageSync("person-id").slice(2) || "";
  var openId = uni.getStorageSync("openid") || "";
  var timeStamp = +new Date();
  var user_role = 0;
  if (personId != "") {
    user_role = 10;
  }
  const params = {
    user_role: user_role, // 用户类型，字符串，默认是0表示未登录，10表示人才，20表示企业
    user_id: personId,            // 当前用户, 字符串，一览ID
    open_id: personId || openId,                // 当前用户，字符串，open_id，与user_id二选一
    promote_id: promote_id || "", // 字符串
    SYS_SOURCE: 'MP_MINIPROGRAM',
    promote_type: 'CAREER_OPPO', // 表示职业机会
    promote_way: promote_way || "", // 表示短信
    t: timeStamp, // 当前时间戳
    cks: "" // 校验和，md5(md5(user_role+user_id+open_id+promote_id+SYS_SOURCE+promote_way)+promote_type+'YL1001')  
  };
  params.cks = MD5(MD5(params.user_role + params.user_id + params.open_id + params.promote_id + params.SYS_SOURCE + params.promote_way) + params.promote_type + 'YL1001');

  console.log('articleDetailBuryingPoint params',params);
  sendArticleDetailBuryingPoint(params).then((res) => {
    console.log('sendArticleDetailBuryingPoint res',res);
  });

};









